package com.iut.sms;

import com.iut.contactlist.Contact;
import com.iut.message.Message;

import android.telephony.SmsManager;
import android.util.Log;

public class SendSMS {
	
	/**
	 * Send an SMS to the Contact
	 * 
	 * @param c The contact to send SMS
	 */
	public SendSMS() {
		// VOID
		;
	}
	
	/**
	 * Send a SMS to the number with the message
	 * 
	 * @param number The number to send SMS
	 * @param message The message to send
	 * @return The message success or failure
	 */
	public boolean sendSMS(Contact c, Message m) {
		String number = c.getNumber();
		String message = m.getText();
		try {
			SmsManager smsManager = SmsManager.getDefault();
			smsManager.sendTextMessage(number, null, message, null, null);
			Log.i("SEND SMS", "Send Succefull to "+number+" with "+message);
		} catch (Exception e) {
			 e.printStackTrace();
		}
		return true;
	}
	
}
